; Ken.Kuang for Pike2 Debug information
; 2017
; Version @ 0000
ASSERT SOFTWARE.BUILD.BASE()>=57080. "The Trace32 software too old"

;cp_pub_address
;0x02000000
;cp_wtl_address
;0x32000000
;ap_address
;0x40000000
;aon_address
;0xA1000000

;share IRAM
;0x00010000
ENTRY &MEM_TYPE="EAXI" &AON_SIRAM_ADDR=0x5000d000 &AON_BASE_ADDR=0x40000000 &DMC_BASE_ADDR=0x30000000
ASSERT DATA.LONG(AVM:0x0)==0x5577 "Please use Per_Preload.cmm!"

CONFIG 16. 8.
WIDTH 23.

; ############################ START OF DJTAG ############################
BASE EAPB:0x0
TREE "DJTAG Scan"
TREE "DEBUG SIGNAL"
	include djtag_chain_pike2.per

TREE.END
TREE "BUSMON BUS STATUS"

;CONFIG 16. 8.
WIDTH 23.

TREE "AON BUS STATUS"
SGROUP "AON"
	TEXTLINE ""
	VARX 0x04 %l DJTAG.SWITCH(0xFFFFFFFF)
	VARX 0x00 %l DJTAG.EXECUTE(0x03012680,0)
	LINE.LONG 0x00 " WCN , WCN(M6) "
	include BusMon_status.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x03022680,0)
	LINE.LONG 0x00 " AP , AP(M0) "
	include BusMon_status.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x03032680,0)
	LINE.LONG 0x00 " WTLCP , WTLCP(M1) "
	include BusMon_status.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x03042680,0)
	LINE.LONG 0x00 " PUBCP , PUBCP(M2) "
	include BusMon_status.per

TREE.END

TREE "WTLCP BUS STATUS"
SGROUP "WTLCP"
	TEXTLINE ""
	VARX 0x04 %l DJTAG.SWITCH(0xFFFFFFFF)
	VARX 0x00 %l DJTAG.EXECUTE(0x05042680,0)
	LINE.LONG 0x00 " TGDSP P , TGDSP P(M2) "
	include BusMon_status.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x05052680,0)
	LINE.LONG 0x00 " TGDSP D , TGDSP D(M3) "
	include BusMon_status.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x05062680,0)
	LINE.LONG 0x00 " TGDSP DMA , TGDSP DMA(M5) "
	include BusMon_status.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x052d2680,0)
	LINE.LONG 0x00 " HU3GE A , HU3GE A(S1) "
	include BusMon_status.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x05322680,0)
	LINE.LONG 0x00 " WDMA1 , WDMA1(M1)"
	include BusMon_status.per

TREE.END

TREE "PUBCP BUS STATUS"
SGROUP "PUBCP"
	TEXTLINE ""
	VARX 0x04 %l DJTAG.SWITCH(0xFFFFFFFF)
	VARX 0x00 %l DJTAG.EXECUTE(0x06002680,0)
	LINE.LONG 0x00 " CR5 L2 , CR5 L2(M0) "
	include BusMon_status.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x06012680,0)
	LINE.LONG 0x00 " CR5 PERI , CR5 PERI(M1) "
	include BusMon_status.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x06022680,0)
	LINE.LONG 0x00 " DMA , DMA(M2) "
	include BusMon_status.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x06062680,0)
	LINE.LONG 0x00 " AON , AON(M6) "
	include BusMon_status.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x06082680,0)
	LINE.LONG 0x00 " DMA LINK1 , DMA LINK1(M8) "
	include BusMon_status.per

TREE.END

TREE.END
; ----------------------------------------------------------
TREE "BUSMON Control"

TREE "AON Control"
SGROUP "AON"
	TEXTLINE ""
	VARX 0x04 %l DJTAG.SWITCH(0xFFFFFFFF)
	VARX 0x00 %l DJTAG.EXECUTE(0x03010880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x03010800,0x1000)
	LINE.LONG 0x00 " WCN , WCN(M6) "
	include BusMon_Chn_int.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x03020880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x03020800,0x1000)
	LINE.LONG 0x00 " AP , AP(M0) "
	include BusMon_Chn_int.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x03030880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x03030800,0x1000)
	LINE.LONG 0x00 " WTLCP , WTLCP(M1) "
	include BusMon_Chn_int.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x03040880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x03040800,0x1000)
	LINE.LONG 0x00 " PUBCP , PUBCP(M2) "
	include BusMon_Chn_int.per


TREE.END

TREE "WTLCP Control"
SGROUP "WTLCP"
	TEXTLINE ""
	VARX 0x04 %l DJTAG.SWITCH(0xFFFFFFFF)
	VARX 0x00 %l DJTAG.EXECUTE(0x05040880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x05040800,0x1000)
	LINE.LONG 0x00 " TGDSP P , TGDSP P(M2) "
	include BusMon_Chn_int.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x05050880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x05050800,0x1000)
	LINE.LONG 0x00 " TGDSP D , TGDSP D(M3) "
	include BusMon_Chn_int.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x05060880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x05060800,0x1000)
	LINE.LONG 0x00 " TG DMA , TG DMA(M5) "
	include BusMon_Chn_int.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x052d0880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x052d0800,0x1000)
	LINE.LONG 0x00 " HU3GE A , HU3GE A(S1) "
	include BusMon_Chn_int.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x05320880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x05320800,0x1000)
	LINE.LONG 0x00 " WDMA1 , WDMA1(M1) "
	include BusMon_Chn_int.per

TREE.END

TREE "PUBCP Control"
SGROUP "PUBCP"
	TEXTLINE ""
	VARX 0x04 %l DJTAG.SWITCH(0xFFFFFFFF)
	VARX 0x00 %l DJTAG.EXECUTE(0x06000880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x06000800,0x1000)
	LINE.LONG 0x00 " CR5 L2 , CR5 L2(M0) "
	include BusMon_Chn_int.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x06010880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x06010800,0x1000)
	LINE.LONG 0x00 " CR5 PERI , CR5 PERI(M1) "
	include BusMon_Chn_int.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x06020880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x06020800,0x1000)
	LINE.LONG 0x00 " DMA , DMA(M2) "
	include BusMon_Chn_int.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x06060880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x06060800,0x1000)
	LINE.LONG 0x00 " AON , AON(M6) "
	include BusMon_Chn_int.per

SGROUP
	VARX 0x00 %l DJTAG.EXECUTE(0x06080880,0)
	WRITEBACK
	SETX AVM:0x1000 %l 0x00
	VARX 0x08 %l DJTAG.EXECUTE(0x06080800,0x1000)
	LINE.LONG 0x00 " DMALINK1 , DMALINK1(M8) "
	include BusMon_Chn_int.per

TREE.END

TREE.END

;----------------------------------------------------


TREE "VOLTAGE DOMAIN STATUS"
TEXTLINE "if TAPID == 0x2381C5FF, It's On, else is Off"
SGROUP "AP Voltage Domain"
	VARX 0x04 %l DJTAG.SWITCH(0xFFFFFFFF)
	VARX 0x00 %l DJTAG.EXECUTE(0x00000180,0)
	LINE.LONG 0x00 " TAPID , TAPID(Chan01) "
SGROUP "MM Voltage Domain"
	VARX 0x00 %l DJTAG.EXECUTE(0x01000180,0)
	LINE.LONG 0x00 " TAPID , TAPID(Chan01) "
SGROUP "GPU Voltage Domain"
	VARX 0x00 %l DJTAG.EXECUTE(0x02000180,0)
	LINE.LONG 0x00 " TAPID , TAPID(Chan01) "
SGROUP "AON Voltage Domain"
	VARX 0x00 %l DJTAG.EXECUTE(0x03000180,0)
	LINE.LONG 0x00 " TAPID , TAPID(Chan01) "
SGROUP "PUB Voltage Domain"
	VARX 0x00 %l DJTAG.EXECUTE(0x04000180,0)
	LINE.LONG 0x00 " TAPID , TAPID(Chan01) "
SGROUP "WTLCP Voltage Domain"
	VARX 0x00 %l DJTAG.EXECUTE(0x05000180,0)
	LINE.LONG 0x00 " TAPID , TAPID(Chan01) "
SGROUP "PUBCP Voltage Domain"
	VARX 0x00 %l DJTAG.EXECUTE(0x060a0180,0)
	LINE.LONG 0x00 " TAPID , TAPID(Chan01) "
SGROUP "WCN Voltage Domain"
	VARX 0x00 %l DJTAG.EXECUTE(0x07000180,0)
	LINE.LONG 0x00 " TAPID , TAPID(Chan01) "

TREE.END


TREE.END
; ############################ END OF DJTAG ############################


TREE "DDR"
BASE &MEM_TYPE:(&AON_BASE_ADDR+0x002B0000)
RGROUP.LONG 0x250++0x03 "PMU"
TEXTLINE ""
LINE.LONG 0x00 " PUB_ACC_RDY , PUB_ACC_RDY "
BITFLD.LONG 0x00 0.      " RDY , PUB_ACC_RDY "
RGROUP.LONG 0x254++0x03
TEXTLINE ""
LINE.LONG 0x00 " PUB_CLK_RDY , PUB_CLK_RDY "
BITFLD.LONG 0x00 0.      " RDY , PUB_CLK_RDY "


;BASE &MEM_TYPE:(&DMC_BASE_ADDR)
;include DMC.per

TREE.END



;CONFIG 16. 8.
WIDTH 23.

; ############################ START OF PMU ############################
BASE &MEM_TYPE:(&AON_BASE_ADDR+0x2B0000)
TREE "PMU Info"
	RGROUP.LONG 0xD4++0x03 "SUBSYS Sleep&Power Status"
	TEXTLINE ""
	LINE.LONG 0x00 " Sleep Status, SLEEP_STATUS "
	BITFLD.LONG 0x00 20.--23. "    SP , SP_SLP_STATUS"  "DSleep,XTLWait,XTLBUFWait,DSleepXTLOn,PLLPWRWait,WakeUp,WakeUpLock,%x..."
	BITFLD.LONG 0x00 12.--15. "   WCN , WCN_SLP_STATUS"  "DSleep,XTLWait,XTLBUFWait,DSleepXTLOn,PLLPWRWait,WakeUp,WakeUpLock,%x..."
	TEXTLINE "                                "
	BITFLD.LONG 0x00 8.--11.  "    CP , CP_SLP_STATUS"  "DSleep,XTLWait,XTLBUFWait,DSleepXTLOn,PLLPWRWait,WakeUp,WakeUpLock,%x..."
	BITFLD.LONG 0x00 0.--3.   "    AP , AP_SLP_STATUS"    "DSleep,XTLWait,XTLBUFWait,DSleepXTLOn,PLLPWRWait,WakeUp,WakeUpLock,%x..."

	TEXTLINE ""
	RGROUP.LONG 0xBC++0x03
	LINE.LONG 0x00 " Power Status 0, PWR_STATUS0_DBG "
	BITFLD.LONG 0x00 4.--7.   "    CA7_C0 , PD_CA7_C0_STATE"     "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	BITFLD.LONG 0x00 8.--11. "    CA7_C1 , PD_CA7_C1_STATE"     "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	BITFLD.LONG 0x00 0.--3.   "   CA7_TOP , PD_CA7_TOP_STATE"      "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	TEXTLINE "                                "
	BITFLD.LONG 0x00 12.--15. "    CA7_C2 , PD_CA7_C2_STATE"     "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	BITFLD.LONG 0x00 16.--19. "    CA7_C3 , PD_CA7_C3_STATE"     "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	BITFLD.LONG 0x00 20.--23. "    AP_SYS , PD_AP_SYS_STATE"     "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	TEXTLINE "                                "
	BITFLD.LONG 0x00 24.--27. "   GPU_TOP , PD_GPU_TOP_STATE"     "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	BITFLD.LONG 0x00 28.--31. "    MM_TOP , PD_MM_TOP_STATE"     "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	

	TEXTLINE ""
	RGROUP.LONG 0xC0++0x03
	LINE.LONG 0x00 " Power Status 1, PWR_STATUS1_DBG "
	BITFLD.LONG 0x00 8.--11. "  WTL_TGDSP , PD_WTLCP_TGDSP_STATE"     "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	BITFLD.LONG 0x00 4.--7.   " WTL_HU3GE_A , PD_WTLCP_HU3GE_A_STATE"   "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	BITFLD.LONG 0x00 0.--3.   " CP_SYS , PD_CP_SYS_STATE"    "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	TEXTLINE "                                "
	BITFLD.LONG 0x00 12.--15.   " PUB_SYS    , PD_PUB_SYS_STATE"    "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	TEXTLINE "                                "
	BITFLD.LONG 0x00 16.--19. "    WCN_TOP , PD_WCN_TOP_STATE"   "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	BITFLD.LONG 0x00 20.--23. "      WIFI  , PD_WCN_WIFI_STATE"      "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"
	BITFLD.LONG 0x00 24.--27. "    GNSS , PD_WCN_GNSS_STATE"  "WAKEUP,POWER_ON_SEQ,POWER_ON_M,RST_ASSERT,POWER_ON_D,RESTORE,ISO_OFF,SHUTDOWN,ACTIVE,STANDBY,SIO_OFF,SAVE_ST,POWER_OFF_D,POWER_OFF_M,BISR_RST,BISR_PROC"

	TEXTLINE ""
	RGROUP.LONG 0xC4++0x03
	LINE.LONG 0x00 " Power Status 2, PWR_STATUS2_DBG "
    BITFLD.LONG 0x00 0. "   CA7_TOP_STATE_4  , PD_CA7_TOP_STATE_4" "OTHERS,WAKEUP_LOCK"
    BITFLD.LONG 0x00 1. "   CA7_C0_STATE_4   , PD_CA7_C0_STATE_4" "OTHERS,WAKEUP_LOCK"
    BITFLD.LONG 0x00 2. "   CA7_C1_STATE_4   , PD_CA7_C1_STATE_4" "OTHERS,WAKEUP_LOCK"
    BITFLD.LONG 0x00 3. "   CA7_C2_STATE_4   , PD_CA7_C2_STATE_4" "OTHERS,WAKEUP_LOCK"
    TEXTLINE "                                "
    BITFLD.LONG 0x00 4. "   CA7_C3_STATE_4   , PD_CA7_C3_STATE_4" "OTHERS,WAKEUP_LOCK"
    BITFLD.LONG 0x00 5. "   AP_SYS_STATE_4   , PD_AP_SYS_STATE_4" "OTHERS,WAKEUP_LOCK"
    BITFLD.LONG 0x00 6. "   GPU_TOP_STATE_4  , PD_GPU_TOP_STATE_4" "OTHERS,WAKEUP_LOCK"
    BITFLD.LONG 0x00 7. "   MM_TOP_STATE_4   , PD_MM_TOP_STATE_4" "OTHERS,WAKEUP_LOCK"
    TEXTLINE "                                "
    BITFLD.LONG 0x00 8. "   CP_SYS_STATE_4   , PD_CP_SYS_STATE_4" "OTHERS,WAKEUP_LOCK"
    BITFLD.LONG 0x00 9. "   HU3GE_A_STATE_4  , PD_WTLCP_HU3GE_A_STATE_4" "OTHERS,WAKEUP_LOCK"
    BITFLD.LONG 0x00 10. "   TGDSP_STATE_4    , PD_WTLCP_TGDSP_STATE_4" "OTHERS,WAKEUP_LOCK"
    BITFLD.LONG 0x00 11. "   PUB_SYS_STATE_4  , PD_PUB_SYS_STATE_4" "OTHERS,WAKEUP_LOCK"
    TEXTLINE "                                "
    BITFLD.LONG 0x00 12. "   WCN_TOP_STATE_4  , PD_WCN_TOP_STATE_4" "OTHERS,WAKEUP_LOCK"
    BITFLD.LONG 0x00 13. "   WIFI_STATE_4     , PD_WCN_WIFI_STATE_4" "OTHERS,WAKEUP_LOCK"
    BITFLD.LONG 0x00 14. "   GNSS_STATE_4     , PD_WCN_GNSS_STATE_4" "OTHERS,WAKEUP_LOCK"
	
	TEXTLINE ""
	RGROUP.LONG 0x250++0x03
	LINE.LONG 0x00 " DDR Access Ready, PUB_ACC_RDY "
	BITFLD.LONG 0x00 0.       "       RDY , PUB_ACC_RDY"

	TEXTLINE ""
	GROUP.LONG 0x274++0x03 "SUBSYS Sleep Counter Clear"
	LINE.LONG 0x00 "   CLR, SLEEP_CNT_CLR "

TREE.END
; ############################ END OF PMU ############################

;CONFIG 16. 8.
;WIDTH 23.


;include PMIC.per

;CONFIG 16. 8.
;WIDTH 23.





